home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-05 / lanscrpt.zip / LOGIN.BAT < prev    next >
DOS Batch File  |  1992-08-18  |  1KB  |  54 lines

  1. :start
  2. @echo off
  3. cls
  4. rem First I start by setting up some enviroment variables that will be used 
  5. rem later to figure out which user it is, and what station they are logging 
  6. rem in from.  Also, I set up a error variable for looping.  (Thanks for the 
  7. rem idea, Rick!)
  8. set name=xxxxxx
  9. set neterror=xxxxxx
  10. set net_error=xxx
  11. rem This is where the real fun stuff comes in,  Using the net user feature, I
  12. rem set up the first string variable: name.  The !"user" macro is used to put 
  13. rem the users login name into the variable.
  14. net user ?"User:" ^"Password:"
  15. net string name !"user"
  16. net login \\server1
  17. if %net_error%==86 goto start
  18. if %net_error%==0 goto continue
  19. if %net_error%==51 goto no_server
  20. goto panic
  21.  
  22. :continue
  23. net string neterror !"login=SERVER1"
  24. if %neterror%==TRUE goto net_ok
  25. if %neterror%==FALSE goto start
  26.  
  27. :net_ok
  28. net use z: \\server1
  29. rem I use z: as the server's control directory, so that I can set up a central 
  30. rem place to configure the network.  Really makes it easy. 
  31. echo Configuring, please wait.
  32. call z:\system
  33. rem z:\system is a batch file that gets run by every workstation on the net.  
  34. rem I use it to setup standard drives, and standard printers.  
  35. goto end
  36.  
  37. rem A little error checking here.
  38. :no_server
  39. echo Server1 is not up yet.
  40. echo Don't panic.
  41. goto start
  42.  
  43. :panic
  44. echo Oops, there's a problem.  Evidently, Server1 is not up at all.
  45. echo Please find Ken.  Thanks.
  46. goto end
  47.  
  48. :end
  49. net logout \\server1
  50. pause
  51. login
  52.  
  53.  
  54.